﻿//
//  Copyright (c) 2011 Extreme: Paweł Huryn (lead), Jakub Domański
//
using System;

namespace Extreme.SPFramework.Cache
{
    /// <summary>
    /// Cache interface
    /// </summary>
    public interface ICache
    {
        /// <summary>
        /// Empty object, returned when not in cache
        /// </summary>
        object Empty { get; }

        /// <summary>
        /// Caches object
        /// </summary>
        /// <param name="key">key</param>
        /// <param name="value">value</param>
        void Save(string key, object value);

        /// <summary>
        /// Caches object
        /// </summary>
        /// <param name="key">key</param>
        /// <param name="value">value</param>
        /// <param name="timeout">time after which cache expires</param>
        void Save(string key, object value, TimeSpan timeout);

        /// <summary>
        /// Clears cache at specified key
        /// </summary>
        /// <param name="key">Cache key</param>
        void Clear(string key);

        /// <summary>
        /// Clear all cached data
        /// </summary>
        void Clear();

        /// <summary>
        /// Gets cached object.
        /// </summary>
        /// <param name="key">Cache key</param>
        /// <returns>Cached object</returns>
        object Get(string key);
    }
}